package com.wudizaba.nb.caffeine.controller;

import com.wudizaba.nb.caffeine.service.serviceImpl.CaffieineServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(value = "/caffeine")
@RequiredArgsConstructor
@Api(tags = "Caffieine接口")
public class CaffieineController {

    private final CaffieineServiceImpl caffieineService;

    /**
     * 手动加载
     * @return
     */
    @ApiOperation("Caffieine手动加载")
    @GetMapping(value = "/handleTest")
    public String CaffieineTestOne() {
        caffieineService.CaffieineTestOne();
        return "test";
    }


    /**
     * 同步加载
     */
    @ApiOperation("Caffieine同步加载")
    @GetMapping(value = "/syncTest")
    public String CaffieineTestTwo() {
        caffieineService.CaffieineTestTwo();
        return "test";
    }

    /**
     * 异步加载
     */
    @ApiOperation("Caffieine异步加载")
    @GetMapping(value = "/asyncTest")
    public String CaffieineTestThree() {
        caffieineService.CaffieineTestThree();
        return "test";
    }
}
